<template>
	<div class="school">
		<h2>学校名称：{{name}}</h2>
		<h2>学校地址：{{address}}</h2>
	</div>
</template>

<script>
	import pubsub from 'pubsub-js'
	export default {
		name: 'School',
		props:['getSchoolName'],
		data() {
			return {
				name:'老八技校',
				address:'厕所'
			}
		},
		mounted() {
			this.pubId = pubsub.subscribe('hello',(msg,data)=>{
				console.log('有人发布了hello消息',data);
			})
		},
		beforeDestroy() {
			pubsub.unsubscribe(pubId)
		}
	}
</script>

<style scoped>
	.school {
		background-color: orange;
	}
</style>
